package com.junyue.control.platform.utils;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

/**
 * 将内存数据写入文件
 */
public class WriteFileUtils {

    public static void createFile(String content, String filePath) {
        try {
            File checkFile = new File(filePath);
            FileWriter writer = null;
            try {
                if (!checkFile.exists()) {
                    checkFile.createNewFile();
                }
                writer = new FileWriter(checkFile, false);
                writer.append(content);
                writer.flush();
            } catch (IOException e) {
                e.printStackTrace();
            } finally {
                if (null != writer) {
                    writer.close();
                }
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
